package com.minyifang.wcspf.work.ui.user.presenter;

import com.minyifang.wcspf.common.base.BasePresenter;
import com.minyifang.wcspf.common.config.network.Constants;
import com.minyifang.wcspf.common.config.network.RetrofitHelper;
import com.minyifang.wcspf.common.config.user.UserManager;
import com.minyifang.wcspf.work.ui.user.view.CouponView;
import com.minyifang.wcspf.work.ui.user.view.MessageView;

import okhttp3.MediaType;
import okhttp3.RequestBody;

/**
 * Created by LuoYaWei on 2018/6/27.
 */
public class MessagePresenter extends BasePresenter<MessageView> {
    public void getMessageData() {
        getView().showLoadingView();
        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), Constants.getJsonData(null, UserManager.getInstance().getToken()).toString());
        addTask(RetrofitHelper.getInstance().getService().getMessageData(requestBody), respond -> {
            getView().hideLoadingView();
            getView().showMessageData(respond);
        });
    }
}
